/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package session02;

import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author macbookpro
 */
public class AccountDeposit1 extends Thread {

    private Account a;

    public AccountDeposit1(Account a) {
        this.a = a;
    }

    public void run() {
        synchronized (a) {
            for (int i = 0; i < 100; i++) {

                a.deposit(10);
                System.out.println(a);

                try {
                    Thread.sleep(100);
                } catch (InterruptedException ex) {
                    Logger.getLogger(AccountDeposit1.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
            a.notify();
        }
    }
}
